package com.swt.gap.controller;

import com.swt.gap.common.graph.GraphNeo4jVO;
import com.swt.gap.service.GraphService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 请填写说明
 *
 * @author sx
 * @date 2020/10/10 11:09
 */
@Api(tags = "fs-xz  demo")
@RestController
@RequestMapping("/demo")
public class XzDemoController {

    private final GraphService graphService;

    public XzDemoController(GraphService graphService) {
        this.graphService = graphService;
    }

    @ApiOperation(value = "人物关系分析")
    @ApiResponse(code = 200, message = "ok", response = GraphNeo4jVO.class)
    @PostMapping("/people-relationship")
    public ResponseEntity<GraphNeo4jVO> getPeopleRelationship() {
        String[] nodeIds = new String[]{"1801067755", "-1388951879", "1980852545"};
        Integer taskId = 460;
        Integer menuTypeCode = 1;
        Integer pageNum = 1;
        Integer pageSize = 100;

        return ResponseEntity.ok(graphService.expendByNodes(nodeIds, taskId, menuTypeCode, pageNum, pageSize));
    }

    @ApiOperation(value = "地址圈分析")
    @ApiResponse(code = 200, message = "ok", response = GraphNeo4jVO.class)
    @PostMapping("/address-relationship")
    public ResponseEntity<GraphNeo4jVO> getAddressRelationship() {
        String[] nodeIds = new String[]{"-1388951877", "1980852547", "1801067757"};
        Integer taskId = 462;
        Integer menuTypeCode = 1;
        Integer pageNum = 1;
        Integer pageSize = 100;

        return ResponseEntity.ok(graphService.expendByNodes(nodeIds, taskId, menuTypeCode, pageNum, pageSize));
    }

    @ApiOperation(value = "亲密度分析")
    @ApiResponse(code = 200, message = "ok", response = GraphNeo4jVO.class)
    @PostMapping("/people-count-relationship")
    public ResponseEntity<GraphNeo4jVO> getPeopleCountRelationship() {
        String[] nodeIds = new String[]{"-1388951878", "1980852546", "1801067756"};
        Integer taskId = 461;
        Integer menuTypeCode = 1;
        Integer pageNum = 1;
        Integer pageSize = 100;

        return ResponseEntity.ok(graphService.expendByNodes(nodeIds, taskId, menuTypeCode, pageNum, pageSize));
    }

    @ApiOperation(value = "资金来往分析")
    @ApiResponse(code = 200, message = "ok", response = GraphNeo4jVO.class)
    @PostMapping("/transaction-relationship")
    public ResponseEntity<GraphNeo4jVO> getTransactionRelationship() {
        String[] nodeIds = new String[]{"-1947469196", "-1120888364", "926006996"};
        Integer taskId = 463;
        Integer menuTypeCode = 1;
        Integer pageNum = 1;
        Integer pageSize = 100;

        return ResponseEntity.ok(graphService.expendByNodes(nodeIds, taskId, menuTypeCode, pageNum, pageSize));
    }

    @ApiOperation(value = "共同消费对象分析")
    @ApiResponse(code = 200, message = "ok", response = GraphNeo4jVO.class)
    @PostMapping("/consume-relationship")
    public ResponseEntity<GraphNeo4jVO> getConsumeRelationship() {
        String[] nodeIds = new String[]{"-1947469194", "-1120888362", "926006998"};
        Integer taskId = 465;
        Integer menuTypeCode = 1;
        Integer pageNum = 1;
        Integer pageSize = 100;

        return ResponseEntity.ok(graphService.expendByNodes(nodeIds, taskId, menuTypeCode, pageNum, pageSize));
    }


}
